<!--园区当前车辆-->
<template>
    <div class="carCurrentClass">
        <CommonTitleComponent text="园区当前车辆"></CommonTitleComponent>
        <div class="content">
            <div class="carCurrent_echarts">
                <chart-view
                    :chart-option="state.equipmentStatistics"
                    :auto-resize="true"
                    height="100%"
                    style="height: 100%; z-index: 1; position: relative"
                ></chart-view>
                <div class="chartInfo">
                    <h3>344</h3>
                    <p>汽车总量</p>
                </div>
                <img src="@img/keji2.png" alt="" />
            </div>
            <ul class="fr">
                <li>
                    <div class="fr_card">
                        <p class="blockColor"></p>
                        <div>
                            <p>10</p>
                            <div>危化品车辆</div>
                        </div>
                    </div>
                    <div class="lastClass">
                        <p>15%</p>
                        <div>占比</div>
                    </div>
                </li>
                <li>
                    <div class="fr_card">
                        <p class="blockColor" style="background: #1b93fb"></p>
                        <div>
                            <p style="color: #1b93fb">10</p>
                            <div>社会车辆</div>
                        </div>
                    </div>
                    <div class="lastClass">
                        <p style="color: #1b93fb">15%</p>
                        <div>占比</div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</template>

<script setup lang="ts">
import { reactive, onMounted, nextTick } from 'vue';
import { EchartsMethods } from '@/chart/index';
/** 3d 饼图配置 */
const datas = {
    alpha: 19,
    distance: 160,
    top: '-7',
    pieData: 30,
    autoRotate: false,
    internalDiameterRatio: 0.85,
    activeVal: {
        value: 120,
        rate: 55
    },
    item: [
        {
            name: '危化品生产',
            value: 80,
            itemStyle: {
                color: '#F23526'
            }
        },
        {
            name: '危化品经营',
            value: 120,
            itemStyle: {
                color: '#1B93FB'
            }
        }
    ]
};
const state = reactive({
    statisticsList: [
        {
            back: '#23FFFC',
            name: '危化品生产',
            num: '202',
            rate: '64%'
        },
        {
            back: '#0066FF',
            name: '危化品经营',
            num: '100',
            rate: '16%'
        },
        {
            back: '#30FFAF',
            name: '危化品使用',
            num: '42',
            rate: '12%'
        },
        {
            back: '#FFDA30',
            name: '其他',
            num: '20',
            rate: '8%'
        }
    ],
    equipmentStatistics: {}
});
onMounted(() => {
    nextTick(() => {
        state.equipmentStatistics = EchartsMethods.equipmentStatistics(datas);
    });
});
</script>

<style scoped lang="scss">
.carCurrentClass {
    height: 22%;
    .content {
        height: 88%;
        display: flex;
        align-items: center;
    }
    .fr {
        flex: 1;
        padding-right: 20px;
        li {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 14px;
            &:last-of-type {
                margin-bottom: 0;
            }

            .lastClass {
                div {
                    @include fontCustomStyle(#fff, 12px);
                }
                p {
                    color: #f23526;
                    @include pmzd();
                    font-size: 14px;
                    margin-bottom: 2px;
                }
            }
            .fr_card {
                display: flex;
                align-items: center;
                > div {
                    p {
                        color: #f23526;
                        @include pmzd();
                        font-size: 14px;
                        margin-bottom: 2px;
                    }
                    div {
                        @include fontCustomStyle(#fff, 12px);
                    }
                }
                .blockColor {
                    width: 10px;
                    height: 6px;
                    background: #f23526;
                    margin-right: 10px;
                }
            }
        }
    }
    .carCurrent_echarts {
        position: relative;
        height: 100%;
        width: 50%;
        .chartInfo {
            position: absolute;
            left: 0;
            top: 22px;
            text-align: center;
            width: 100%;
            color: #fff;
            z-index: 1;
            h3 {
                font-size: 20px;
            }
            p {
                color: #dfeef3;
                font-size: 12px;
            }
        }
        img {
            position: absolute;
            left: 4px;
            top: 50%;
            margin-top: -40px;
            width: 92%;
            height: 80px;
            z-index: 0;
        }
    }
}
</style>
